﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using static System.Windows.Forms.VisualStyles.VisualStyleElement;

namespace sy3_1
{
    public partial class UserControl1: UserControl
    {
        public UserControl1()
        {
            InitializeComponent();
        }

        private void label4_Click(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                // 从输入文本框获取值（默认名称TextBox1~TextBox3）
                double x = double.Parse(textBox1.Text);
                double y = double.Parse(textBox2.Text);
                double r = double.Parse(textBox3.Text);

                // 创建Circle对象并计算
                Class1 circle = new Class1();
                circle.SetValue(x, y, r);

                // 显示结果（默认名称TextBox4~TextBox6）
                textBox4.Text = circle.GetArea().ToString();  // 面积
                textBox5.Text = circle.GetPerimeter().ToString();  // 周长
                textBox6.Text = circle.GetDistance().ToString();  // 距离
            }
            catch (FormatException)
            {
                MessageBox.Show("输入格式错误，请输入数字！", "提示");
            }
        }
    }
}
